package com.realsatan.gae.wtm;

import java.util.*; 
import javax.jdo.annotations.*; 
import com.google.appengine.api.users.User;
import com.google.appengine.api.datastore.Text;

@PersistenceCapable(identityType = IdentityType.APPLICATION) 
public class Message implements java.io.Serializable {
	private static final long serialVersionUID = -2895252433150453947L;

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;
	
    @Persistent
    private int floor;
    
    @Persistent
    private User user;
    
    @Persistent
    private Date date; 
    
    @Persistent
    private String message;
    
    @Persistent
    private String info;

	public Message(Long id) {
		this.id = id;
    }
    
	public Message(int floor, User user, String message, Date date) {
		this.floor = floor;
    	this.user = user;
    	this.message = message;
    	//this.message = new Text(message);
    	this.date = date; 
    	this.info = "";
    } 
	
	public Message(User user, int floor, String message, Date date, String info) {
		this.floor = floor;
    	this.user = user;
    	this.message = message;
    	//this.message = new Text(message);
    	this.date = date;
    	this.info = info;
    }

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public int getFloor() {
		return floor;
	}

	public void setFloor(int floor) {
		this.floor = floor;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getMessage() {
		if(message != null) {
			//return message.getValue();
			return message;
		} else {
			return "";
		}
	}

	public void setMessage(String message) {
		//this.message = new Text(message);
		this.message = message;
	}

	public String getInfo() {
		return info;
	}

	public void setInfo(String info) {
		this.info = info;
	}   

}
